package com.youle.askdao.entity.bean;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * @author: create by MrGe
 * @version: v1.0
 * @description: com.youle.askdao.entity
 * @date:2019-07-23
 */
@Table(name = "sys_user")
@Data
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiParam(value = "id")
    private Long id;

    // 账号
    private String userCode;

    // 用户别名
    private String userName;

    // 密码
    @JsonIgnore
    @Length(min = 6,max = 20,message = "密码的最小长度为6，最大长度为20")
    private String password;

    // 渠道商ID
    private String channelCode;

    //渠道商名称
    @ApiParam(value = "渠道商名称")
    private String channelName;

    //用户等级
    private Integer userLevel;

    //邀请码
    private String inviteCode;

    //公司id（部门id）
    private Long companyId;

    //省代码
    @ApiParam(value = "省代码")
    private String provinceCode;

    //城市代码
    @ApiParam(value = "城市代码")
    private String cityCode;

    //区域代码
    private String areaCode;

    //地址
    @ApiParam(value = "地址")
    private String address;

    //统一社会信用代码
    @ApiParam(value = "统一社会信用代码")
    private String creditCode;

    //手机号
    @ApiParam(value = "手机号")
    @Pattern(regexp = "^1[3578]{1}\\d{9}$", message = "手机号格式不正确")
    private String phone;

    //邮箱
    @ApiParam(value = "邮箱")
    @Pattern(regexp = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$", message = "邮箱格式不正确")
    private String email;

    //创建时间
    private Date createTime;

    //上级用户
    private Long createUser;

    //备注
    private String note;
    //是否删除（0：未删除，1：已删除）
    private Integer isDel;

}

